package com.gitee.minimalismstyle.fresh.common.document.xml

import javax.xml.bind.annotation.adapters.XmlAdapter

class StringToClassXmlAdapter : XmlAdapter<String, Class<*>>() {

    override fun unmarshal(clazzName: String?): Class<*>? {
        return if(clazzName.isNullOrBlank()){
            null
        } else {
            Class.forName(clazzName)
        }
    }

    override fun marshal(clazz: Class<*>?): String? {
        return clazz?.name
    }
}